package com.cryptoneedle.garden.repository.garden.doris;


import com.bubbles.engine.data.core.repository.BaseRepository;
import com.cryptoneedle.garden.entity.garden.doris.DorisDatabase;
import com.cryptoneedle.garden.key.DatabaseKey;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>description: Doris-元数据-SourceDatabase </p>
 *
 * @author CryptoNeedle
 * @date 2025-09-25
 */
@Repository
public interface DorisDatabaseRepository extends BaseRepository<DorisDatabase, DatabaseKey> {

    @Query("FROM DorisDatabase ORDER BY catalogName, databaseName")
    List<DorisDatabase> dorisDatabases();

    @Query("""
             FROM DorisDatabase
            WHERE catalogName = :catalogName
            ORDER BY catalogName, databaseName
            """)
    List<DorisDatabase> dorisDatabases(String catalogName);
}